﻿using System;
using BLL;

public partial class Assemble_ViewAssemble_AssembleDetailViewbySN : System.Web.UI.Page
{
    AssembleDetail amd;
    AssembleDetails amds;

    //没有用到分页等刷新页面的事件，这里属性可以用变量替换
    private string productSN
    {
        get
        {
            return ViewState["ProductSN"].ToString();
        }
        set
        {
            ViewState["ProductSN"] = value;
        }
    }

    public Assemble_ViewAssemble_AssembleDetailViewbySN()
    {
        amd = new AssembleDetail();
        amds = new AssembleDetails();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["ProductSN"] != null)
            {
                productSN = Request.QueryString["ProductSN"];
                this.TextBox1.Text = productSN;
                productSN = CommHelper.GetProductSN(productSN);
                BindData();
            }
        }
    }

    protected void BindData()
    {
        this.GridView1.DataSource = amd.GetAssembleDetailbySN(productSN);
        this.GridView1.DataBind();
        this.GridView2.DataSource = amds.GetAssembleDetailsbySN(productSN);
        this.GridView2.DataBind();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        productSN = this.TextBox1.Text.Trim();
        productSN = CommHelper.GetProductSN(productSN);
        BindData();
    }
}
